<template>
  <com-card>
    <div slot="com_header">
      <el-button type="primary">添加商品分类</el-button>
    </div>
    <div slot="com_content">
      <el-table border :data="dataSoss">
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column label="分类名称" prop="cat_name"></el-table-column>
        <el-table-column label="是否有效" prop="cat_deleted"></el-table-column>
        <el-table-column label="分类级别" prop="cat_pid"></el-table-column>
        <el-table-column label="操作">

          <!-- cat_id	分类 ID
cat_name	分类名称
cat_pid	分类父 ID
cat_level	分类当前层级 -->

          <template #default="{row}">
                <el-button>编辑</el-button>
                <el-button>删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </com-card>
</template>

<script>
import ComCard from "../../components/comCard/index.vue";
import { api_query } from "../../api/SPFL.js";
export default {
  components: {
    ComCard,
  },
  data() {
    return {
      formObj: {
        type:3,
        pagenum: 1,//当前页数
        pagesize:4,//每页显示条数
      },
      dataSoss:[],//商品分类列表渲染
    };
  },
  mounted() {
    this.query();
  },
  methods: {
    async query() {
      // cat_id: 1, cat_name: '大家电', cat_pid: 0, cat_level: 0, cat_deleted: false, …}
      let rst = await api_query(this.formObj);
      let {data}=rst.data;
      this.dataSoss=data;
      // let {msg,status}=rst.meta;
      // this.dataSoss.status= status;
      console.log(rst);
    },
  },
};
</script>

<style lang="less" scoped>
</style>